//
//  MTCameraAlertView.m
//  UITextVIew
//
//  Created by upintech on 17/6/12.
//  Copyright © 2017年 ZZMo. All rights reserved.
//

#import "MTCameraAlertView.h"

@implementation MTCameraAlertView

+ (instancetype)cameraAlertView {
    
    return [[[NSBundle mainBundle] loadNibNamed:@"MTCameraAlertView" owner:nil options:nil] lastObject];
}


#pragma mark - action
- (IBAction)cancelBtnDidClick:(UIButton *)sender {
    
    if (_cancelBlock) {
        
        _cancelBlock();
    }
    [self removieAlertFromSuperView];
}

- (IBAction)voiceBtnDidClick:(UIButton *)sender {
    
    if (self.sourceVoiceBlock) {
        self.sourceVoiceBlock();
    }
}



- (IBAction)CameraTapClick:(id)sender {
    
    if (_sourceCameraBlock) {
        
        self.sourceCameraBlock();
    }
    [self removieAlertFromSuperView];
    
}

- (IBAction)SourePhoneTapClick:(id)sender {
    
    if (_sourcePhoneBlock) {
        
        self.sourcePhoneBlock();
    }
    [self removieAlertFromSuperView];
}

- (IBAction)CancelTapClick:(id)sender {
    
    
    if (_cancelBlock) {
        
        _cancelBlock();
    }
    [self removieAlertFromSuperView];
}

- (void)removieAlertFromSuperView {
    
    __block CGRect frame = self.frame;
    [UIView animateWithDuration:0.25 animations:^{
       
        frame.origin.y = [UIScreen mainScreen].bounds.size.height;
        self.frame = frame;
    } completion:^(BOOL finished) {
        
        [self removeFromSuperview];
    }];
}





@end
